broadway: Fix image updates for firefox
authorAlexander Larsson <alexl@redhat.com>
Fri, 13 Mar 2020 07:10:41 +0000 (08:10 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 13 Mar 2020 14:00:18 +0000 (15:00 +0100)
For whatever reason we need to assign the function to a variable
to be able to call it.

gdk/broadway/broadway.js

index 793aa56bea26bc5e45aa124c96e5d4221531958c..2478aacc7c70b1fead39dc3fc9a37d87a6da4dcf 100644 (file)
@@ -997,12 +997,13 @@ function handleDisplayCommands(display_commands)
         case DISPLAY_OP_CHANGE_TEXTURE:
             var image = cmd[1];
             var texture = cmd[2];
-            // We need a new closure here to have a separate copy of "template" for each iteration...
-            function a_block(t) {
+            // We need a new closure here to have a separate copy of "texture" for each iteration in the onload callback...
+            var block = function(t) {
                 image.src = t.url;
                 // Unref blob url when loaded
                 image.onload = function() { t.unref(); };
-            }(texture);
+            };
+            block(texture);
             break;
         case DISPLAY_OP_CHANGE_TRANSFORM:
             var div = cmd[1];